<template>
  <template v-if="fieldInfo.type === 'selection'">
    <WSelection
      v-model="value2"
      :node="node"
      :formInfo="formInfo"
      @change="onChangeNext"
    />
  </template>

  <template v-else>
    todo WRadio
    {{ value_display }}
  </template>
</template>

<script setup>
import WSelection from './WSelection.vue'

import { useWidget } from './userWidget'

const props = defineProps(['modelValue', 'node', 'formInfo'])
const emit = defineEmits(['update:modelValue', 'change'])

const useData = useWidget(props, { emit })

const { fieldInfo, readonly, value_display } = useData
const { value2, onChange } = useData

function onChangeNext(fname, value) {
  // console.log('onChange  ', value)
  onChange(fname, value)
}
</script>

<style type="text/css"></style>
